Fix audit gaps: URL validation, curl timeouts, heartbeat backoff, health response - #4
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe changes enhance HTTP request handling with URL validation and response body capture, add exponential backoff retry logic for heartbeat transmission, propagate agent ID through the health endpoint, and enforce timeout constraints on external service calls. Changes
Sequence DiagramsequenceDiagram
participant Agent as Agent Loop
participant HB as HeartbeatClient
participant Service as Heartbeat Service
participant Logger as Logging System
Agent->>HB: send_heartbeat_with_retry()
loop Attempt 1 to MAX_CONSECUTIVE_FAILURES
HB->>Service: send_heartbeat()
alt Success
Service-->>HB: HeartbeatResponse
HB-->>Agent: return Ok(response)
else Failure
Service-->>HB: HeartbeatError
HB->>Logger: warn!(last error)
alt Max Retries Reached
HB->>Logger: warn!(max retries exceeded)
HB->>Logger: error!(exhausted retries)
HB-->>Agent: return Err(last_error)
else More Retries Available
HB->>HB: sleep(backoff_delay_secs(attempt))
Note over HB: Exponential delay: 2^(attempt+1),<br/>capped at 60 seconds
end
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ealth agent_id, response body capture
- Add URL validation in sigops.http: reject non-http(s) schemes, newlines, null bytes, control chars
- Add curl timeouts: --max-time 30 / --connect-timeout 5 for HTTP, --max-time 10 / --connect-timeout 5 for Slack
- Add heartbeat retry with exponential backoff (2s, 4s, 8s, 16s, max 60s, 5 max retries)
- Make webhookUrl required for sigops.notify_slack (remove placeholder default)
- Add agent_id to health endpoint JSON response
- Capture response body in HTTP tool using curl -w "\n%{http_code}" pattern
- Add comprehensive tests: URL validation, timeout flags, webhook requirement, body parsing, backoff calc
https://claude.ai/code/session_016BNDbB5ERJFsXQZiuL6tL1
2e21296 to
2a5e179
Compare
Summary
Test plan
cargo test— 35 tests passingcargo clippy -- -D warnings— zero warningshttps://claude.ai/code/session_016BNDbB5ERJFsXQZiuL6tL1
Summary by CodeRabbit
New Features
Bug Fixes
Improvements